const Generator = require("yeoman-generator");

module.exports = class extends (
  Generator
) {
  prompting() {
    return this.prompt({
      type: "input",
      name: "name",
      message: "Your project name",
      default: this.appname,
    }).then(answers => {
      this.answers = answers;
    });
  }

  writing() {
    const templates = [
      ".browserslistrc",
      ".gitignore",
      "babel.config.js",
      "package.json",
      "README.md",
      "tsconfig.json",
      "tslint.json",
      "public/favicon.ico",
      "public/index.html",
      "src/App.vue",
      "src/main.ts",
      "src/shims-tsx.d.ts",
      "src/shims-vue.d.ts",
      "src/assets/logo.png",
      "src/components/HelloWorld.vue",
      "src/router/index.ts",
      "src/store/index.ts",
      "src/views/About.vue",
      "src/views/Home.vue",
    ];
    templates.forEach(item => {
      this.fs.copyTpl(
        this.templatePath(item),
        this.destinationPath(item),
        this.answers
      );
    });
  }
};
